package com.example.administrator.appjiamzhi;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by Administrator on 2017/1/5.
 */
public class gerenzhongxin extends zhuye {
    private Button fanhuiButton,jibenButton,gongzuoButton,qiangbaoButton,genduoButton,
    shouchangButton,tuichuButton;
    private static Boolean isExit = false;
    private static Boolean hasTask = false;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gerenzhongxin);
        fanhuiButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(gerenzhongxin.this,zhuye.class);
                startActivity(intent);
            }
        });
        jibenButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(gerenzhongxin.this,gerenzhongxin01.class);
                startActivity(intent);
            }
        });
        genduoButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(gerenzhongxin.this,genduo.class);
                startActivity(intent);
            }
        });
        qiangbaoButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(gerenzhongxin.this,qianbao.class);
                startActivity(intent);
            }
        });
        gongzuoButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(gerenzhongxin.this,gongzuo.class);
                startActivity(intent);
            }
        });
        shouchangButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(gerenzhongxin.this,shoucang.class);
                startActivity(intent);
            }
        });
        tuichuButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Timer tExit = new Timer();
                TimerTask task = new TimerTask() {


                    public void run() {
                        isExit = false;
                        hasTask = true;
                    }
                };
            }

            public boolean onKeyDown(int keyCode, KeyEvent event) {
                final AlertDialog.Builder builder = new AlertDialog.Builder(gerenzhongxin.this);
                builder.setTitle("提示");
                builder.setMessage("您要退出吗?");
                builder.setPositiveButton("是的", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                   System.exit(0);
                    }
                });
                builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        builder.create();
                    }
                });
                builder.show();
                return true;
            }

        });

}
    }